﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package com.facebook.utils {
    import com.adobe.serialization.json.*;

    public class FacebookDataUtils {

        public static function toJSONValuesArray(_arg1:Array):String{
            if (_arg1 == null){
                return (null);
            };
            var _local2:Array = [];
            var _local3:Number = _arg1.length;
            var _local4:Number = 0;
            while (_local4 < _local3) {
                _local2.push(JSON.encode(_arg1[_local4]));
                _local4++;
            };
            return (_local2.join(","));
        }
        public static function formatDate(_arg1:String):Date{
            var _local4:Array;
            var _local5:Array;
            if ((((_arg1 == "")) || ((_arg1 == null)))){
                return (null);
            };
            var _local2:Date = new Date();
            var _local3:Array = _arg1.split(" ");
            if (_local3.length == 2){
                _local4 = _local3[0].split("-");
                _local5 = _local3[1].split(":");
                _local2.setFullYear(_local4[0]);
                _local2.setMonth((_local4[1] - 1));
                _local2.setDate(_local4[2]);
                _local2.setHours(_local5[0]);
                _local2.setMinutes(_local5[1]);
                _local2.setSeconds(_local5[2]);
            } else {
                _local2.setTime((parseInt(_arg1) * 1000));
            };
            return (_local2);
        }
        public static function facebookCollectionToJSONArray(_arg1:FacebookArrayCollection):String{
            if (_arg1 == null){
                return (null);
            };
            return (JSON.encode(_arg1.toArray()));
        }
        public static function toDateString(_arg1:Date):String{
            if (_arg1 == null){
                return (null);
            };
            _arg1.setDate((_arg1.date + 1));
            return (((_arg1 == null)) ? null : _arg1.getTime().toString().slice(0, 10));
        }
        public static function supplantString(_arg1:String, _arg2:Object):String{
            var _local4:String;
            var _local3:String = _arg1;
            for (_local4 in _arg2) {
                _local3 = _local3.replace(new RegExp((("\\{" + _local4) + "\\}"), "g"), _arg2[_local4]);
            };
            return (_local3);
        }
        public static function toArrayString(_arg1:Array):String{
            return (((_arg1 == null)) ? null : _arg1.join(","));
        }

    }
}//package com.facebook.utils 
